/**
 * @Author: 健聪
 * @Description: 构造方法
 * @Date: 2024/1/17
 */
void main() {
  var person = new Person("Tom", 20, "male");
  person.work();
  var person2 = new Person.withName("Jerry", "male");
  person2.work();
  var person3 = new Person.withAge(30, "male");
  person3.work();
}

class Person {
  String? name;
  int? age;
  final String gender;

  Person(this.name, this.age, this.gender);

  Person.withName(String name, this.gender);

  Person.withAge(int age, this.gender);

  void work() {
    print("Work...$name,$age, $gender");
  }
}